package io.github.talelin.latticy.utils;

import io.github.talelin.autoconfigure.exception.ParameterException;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    private static String dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";

    public static Date stringConvertDate(String s) {
        SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
        try {
            // 使用SimpleDateFormat的parse方法将字符串转换为Date对象
            return formatter.parse(s);
        } catch (Exception e) {
            return null;
        }
    }
    public static String DateConvertString(Date d) {
        SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
        try {
            // 使用SimpleDateFormat的parse方法将字符串转换为Date对象
            return formatter.format(d);
        } catch (Exception e) {
            return null;
        }
    }

}
